﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace RCSnake
	{
	abstract class Food : Shape
		{
		/*---------------------------------------------*\
		|*                 Attributs                   *|
		\*---------------------------------------------*/
		protected int m_points;
		protected int m_enlargement;
		protected Random m_random;
		protected bool m_exists;
		/*---------------------------------------------*\
		|*                Constructeur                 *|
		\*---------------------------------------------*/
		public Food(Area area, Size size, Point position)
			: base(area, size, position)
			{
			m_exists = false;
			m_random = new Random();
			this.changePosition();
			}

		/*---------------------------------------------*\
		|*               Methodes public               *|
		\*---------------------------------------------*/
		public virtual void changePosition()
			{
			int posX = m_random.Next(m_area.border.rectangleBorder.X, m_area.border.rectangleBorder.Width);
			int posY = m_random.Next(m_area.border.rectangleBorder.Y, m_area.border.rectangleBorder.Height);
			m_position.X = posX;
			m_position.Y = posY;
			}
		/*---------------------*\
		|*      get / set      *|
		\*---------------------*/
		public int points
			{
			get { return m_points; }
			}

		public int enlargement
			{
			get { return m_enlargement; }
			}

		public Random random
			{
			get { return m_random; }
			}

		public bool exists
			{
			get { return m_exists; }
			set { m_exists = value; }
			}
		}
	}
